home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: cwi.nl!dik
- From: dik@cwi.nl (Dik T. Winter)
- Subject: Re: Tough FACTORIAL math problem...
- Message-ID: <DMy8EM.DCA@cwi.nl>
- Sender: news@cwi.nl (The Daily Dross)
- Nntp-Posting-Host: chrysant.cwi.nl
- Organization: CWI, Amsterdam
- References: <31224679.6193@born.com> <4fv16m$cuj@winx03.informatik.uni-wuerzburg.de> <4g339u$dkk@news.microsoft.com>
- Date: Sun, 18 Feb 1996 02:03:57 GMT
-
- In article <4g339u$dkk@news.microsoft.com> a-cnadc@microsoft.com (Dann Corbit) writes:
- > Jochen's program is almost there, but it will fail
- > when the factor produces two zeros. Here is one
- > that will do the job. The number "100000L" has to
- > be chosen carefully, so that it will not overflow
- > when multiplied by the next factor, and so that it
- > will not truncated needed digits of precision. It
- > must be larger than n and smaller than MAX_LONG/n:
-
- Being larger than n is no guarantee. 100,000 fails for n = 9375 or larger.
- Actually when 5^n <= n < 5^(n+1) you need 10^(n+1) to be sure (although
- smaller values might work). 9375 = 3*5^5, so you need 1,000,000 in that
- case to be sure (and that is the smallest number for which it is required).
- --
- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924098
- home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
-